package br.ufrgs.dbproject.idgenerator;

import br.ufrgs.dbproject.Context;

/**
 * ID generation strategy interface (Strategy Pattern).
 * 
 * <p>
 * Each generation strategy must implements this interface.
 * </p>
 * 
 * @author diego
 * 
 * @see <a href="http://en.wikipedia.org/wiki/Strategy_pattern">Strategy Pattern</a>
 */
public interface IDGeneratorStrategy<T extends ID> {

	/**
	 * Check if this strategy can handle the provided {@link Context}
	 * 
	 * @param context The SAX parser context
	 * @return true if this IDGeneratorStrategy can handle the provided {@link Context}, false otherwise
	 */
	public boolean canHandle(Context<T> context);
	
	/**
	 * Generates a valid Dewey ID based on the provided {@link Context}
	 * 
	 * @param context The SAX parser context
	 * @return the generated ID
	 */
	public T generate(Context<T> context);
}
